package com.jk.bggoods.controller;

import com.jk.bggoods.entity.*;
import com.jk.bggoods.pojo.GoodsEntity;
import com.jk.bggoods.service.GoodsService;
import com.jk.damaicommon.wlentity.SessionSiteEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @RequestMapping(value = "selectAllGoods",method = RequestMethod.POST)
    public HashMap<String,Object> selectAllGoods(@RequestBody GoodsEntity goods){
        return goodsService.selectAllGoods(goods);
    }

    @RequestMapping("downGoods")
    public void downGoods(Integer goodsId){
        goodsService.downGoods(goodsId);
    }

    @RequestMapping("upGoods")
    public void upGoods(Integer goodsId){
        goodsService.upGoods(goodsId);
    }

    @RequestMapping("selectOneGoods")
    public GoodsEntity selectOneGoods(Integer goodsId){
        return goodsService.selectOneGoods(goodsId);
    }
    /**
    *  @方法描述 (商品详情)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/6 
     * @Param [goodsId]
     * @return com.jk.bggoods.entity.GoodsDetailEntity
     **/
    @RequestMapping("getGoodsById")
    public GoodsDetailEntity getGoodsById(Integer goodsId){
        return goodsService.getGoodsById(goodsId);
    }
    /**
    *  @方法描述 (城市下拉)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/6 
     * @Param []
     * @return java.util.List<CityEntity>
     **/
    @RequestMapping("getCitySelect")
    public List<CityEntity> getCitySelect(){
        return goodsService.getCitySelect();
    }
   /**
   *  @方法描述 (类型动态下拉)
    * @Author 王乐
    * @Description //TODO 
    * @Date  2021/9/6 17:07
    * @Param []
    * @return java.util.List<GoodsTypeEntity>
    **/
    @RequestMapping("getTypeSelect")
    public List<GoodsTypeEntity> getTypeSelect(){
        return goodsService.getTypeSelect();
    }
    /**
    *  @方法描述 (系列活动动态下拉)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/6 17:14
     * @Param []
     * @return java.util.List<com.jk.bggoods.entity.GoodsActiveEntity>
     **/
    @RequestMapping("getActiveSelect")
    public List<GoodsActiveEntity> getActiveSelect(){
        return goodsService.getActiveSelect();
    }
    /**
     * xinzeng shangpin
     */
   /* @RequestMapping("addGoods")
    public void addGoods(@RequestBody GoodsDetailEntity goods){
        goodsService.addgoods(goods);
    }*/
    /**
     * 回收站查询
     */
    @RequestMapping(value = "recycleSelectMap",method = RequestMethod.POST)
    public HashMap<String, Object> recycleSelectMap(@RequestBody GoodsEntity goods){
        return goodsService.recycleSelectMap(goods);
    }
    /**
     * 彻底删除
     */
    @RequestMapping("deleteThisGoods")
    public void deleteThisGoods(Integer goodsId){
        goodsService.deleteThisGoods(goodsId);
    }
    /**
    *  @方法描述 (新增商品)
     * @Author 王乐
     * @Description //TODO
     * @Date  2021/9/10 0:01
     * @Param [goods]
     * @return void
     **/
    @RequestMapping(value = "addGoods",method = RequestMethod.POST)
    public void addGoods(@RequestBody GoodsDetailEntity goods){
        goodsService.addGoods(goods);
    }
    /**
    *  @方法描述 (获取配送方式)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/12 10:41
     * @Param []
     * @return java.lang.String
     **/
    @RequestMapping("getDistr")
    public String getDistr(){
        return goodsService.getDistr();
    }

    //新增系列活动
    @RequestMapping(value = "addActive",method = RequestMethod.POST)
    public void addActive(@RequestBody ActiveEntity activeEntity){
        goodsService.addActive(activeEntity);
    }
    /**
    *  @方法描述 (座位管理场次列表)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/21 6:45
     * @Param []
     * @return java.util.List<com.jk.damaicommon.wlentity.SessionSiteEntity>
     **/
    @RequestMapping("getSessionList")
    public List<SessionSiteEntity> getSessionList(@RequestBody SessionSiteEntity sessionSite){
        return goodsService.getSessionList(sessionSite);
    }
    /**
    *  @方法描述 (档次动态下拉)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/21 10:28
     * @Param [id]
     * @return java.util.List<com.jk.bggoods.entity.GoodsLeaveEntity>
     **/
    @RequestMapping("getLeaveSelect")
    public List<GoodsLeaveEntity> getLeaveSelect(Integer id){
        List<GoodsLeaveEntity> list = goodsService.getLeaveSelect(id);
        return list;
    }
    /**
    *  @方法描述 (提交座位表)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/21 13:28
     * @Param [site]
     * @return void
     **/
    @RequestMapping("saveSite")
    public void saveSite(@RequestBody SessionSiteEntity site){
        goodsService.saveSite(site);
    }
    /**
    *  @方法描述 (获取座位信息)
     * @Author 王乐
     * @Description //TODO 
     * @Date  2021/9/21 14:09
     * @Param [id]
     * @return java.lang.String
     **/
    @RequestMapping("getSiteInfo")
    public String getSiteInfo(Integer id){
        return goodsService.getSiteInfo(id);
    }
}
